public class Room {
    private String roomNumber;
    private Student[] beds;

    public Room(String roomNumber, int bedCount) {
        this.roomNumber = roomNumber;
        this.beds = new Student[bedCount];
    }

    // 获取房间号
    public String getRoomNumber() {
        return roomNumber;
    }

    // 获取床位数组
    public Student[] getBeds() {
        return beds;
    }

    // 分配学生到床位
    public boolean assignStudentToBed(int bedNumber, Student student) {
        if (bedNumber >= 0 && bedNumber < beds.length && beds[bedNumber] == null) {
            beds[bedNumber] = student;
            return true;
        }
        return false;
    }

    // 打印床位信息
    public void printBedsInfo() {
        for (int i = 0; i < beds.length; i++) {
            if (beds[i] == null) {
                System.out.println("  床位 " + (i + 1) + ": 空闲");
            } else {
                System.out.println("  床位 " + (i + 1) + ": " + beds[i].getName() + " (学号: " + beds[i].getId() + ")");
            }
        }
    }
}
